home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DSIIC2.ARJ / TWO-WAY.C < prev    next >
C/C++ Source or Header  |  1991-07-15  |  2KB  |  81 lines

  1. /* Copyright (c) James L. Pinson 1990,1991  */
  2.  
  3. /**********************   TWO-WAY.C   ***************************/
  4.  
  5. /* demonstrates partial/full menus */
  6.  
  7. #include "mydef.h"
  8. #include <stdio.h>
  9.  
  10. /* defines */
  11.  
  12. #define FULL    1
  13. #define PARTIAL 2
  14.  
  15. /* function prototypes */
  16.  
  17. int fake(void);
  18.  
  19.  
  20. int start(int argc, char *argv[])
  21. {
  22. extern struct screen_structure scr;
  23. extern struct window_structure w[];
  24.  
  25. struct pop_struc *menu;
  26. int return_code;
  27. int i;
  28. char string[MAX_STRING];
  29.  
  30.  
  31.  /* set up menu structure */
  32.  
  33.  struct pop_struc partial[7]={       /* partial menu */
  34.  /*  *name   (*fun)()  select_id  */
  35.     " Load    " ,fake,   0,
  36.     " Save    " ,fake,   0,
  37.     " Compile " ,fake,   0,
  38.     " Run     " ,fake,   0,
  39.     " Full    " ,NULL,   FULL,       /* return "FULL" */
  40.     " Quit    " ,NULL,   0,
  41.     "\0"      /* mark the end of the options list */
  42.  };
  43.  
  44.  struct pop_struc full[11]={         /* full menu */
  45. /*  *name   (*fun)()  select_id  */
  46.     " Load    " ,fake,   0,
  47.     " Save    " ,fake,   0,
  48.     " Compile " ,fake,   0,
  49.     " Edit    " ,fake,   0,
  50.     " Run     " ,fake,   0,
  51.     " Debug   " ,fake,   0,
  52.     " Options " ,fake,   0,
  53.     " proJect " ,fake,   0,
  54.     " Partial " ,NULL,   PARTIAL,       /* return "PARTIAL" */
  55.     " Quit    " ,NULL,   0,
  56.     "\0"      /* mark the end of the options list */
  57.  };
  58.  
  59. menu= partial;       /* set *menu to point to the partial menu */
  60.  
  61.  
  62.    /* loop until user presses "Escape" or selects "Quit" */
  63.    for(;;){
  64.  
  65.    /* call pop_up() giving it the partial menu */
  66.     return_code= (pop_up(menu,33,10,scr.normal,scr.inverse));
  67.  
  68.       switch (return_code){
  69.        case FULL:    menu=full;break;     /* select full menu */
  70.        case PARTIAL: menu=partial;break;  /* select partial menu */
  71.       }
  72.      if (return_code==0) return(0);       /* Quit or Escape */
  73.    }
  74. }
  75.  
  76.  
  77. int fake(void)
  78. {
  79. return(0);  /* return a zero so the menu does not close */
  80. }
  81.